//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_chopper_welcome2.sqf"
#include "x_setup.sqf"

private ["_state", "_vec", "_welcome_str1", "_welcome_str2", "_welcome_str3", "_welcome_str4", "_end_welcome", "_hud", "_control"];
disableSerialization;
GVAR(rsc_end) = false;
PARAMS_2(_state,_vec);
_welcome_str1 = format [localize "STR_DOM_MISSIONSTRING_183", GVAR(name_pl)];

switch (_state) do {
	case 1: {
		_welcome_str2 = localize "STR_DOM_MISSIONSTRING_184";
		_welcome_str3 = localize "STR_DOM_MISSIONSTRING_185";
	};
	case 0: {
		_welcome_str2 = localize "STR_DOM_MISSIONSTRING_186";
		_welcome_str3 = localize "STR_DOM_MISSIONSTRING_187";
	};
	default {
		_welcome_str2 = localize "STR_DOM_MISSIONSTRING_188";
		_welcome_str3 = localize "STR_DOM_MISSIONSTRING_189";
	};
};

_ttyp = toUpper (typeOf _vec);
_welcome_str4 = if (_ttyp in GVAR(check_ammo_load_vecs)) then {
	 (localize "STR_DOM_MISSIONSTRING_190")
} else {
	(localize "STR_DOM_MISSIONSTRING_191")
};

_end_welcome = time + 14;
67322 cutRsc ["chopper_hud", "PLAIN"];
_hud = __uiGetVar(DCHOP_HUD);
#define __CTRL(A) (_hud displayCtrl A)
__CTRL(64438) ctrlSetText _welcome_str1;
__CTRL(64439) ctrlSetText _welcome_str2;
__CTRL(64440) ctrlSetText _welcome_str3;
__CTRL(64441) ctrlSetText _welcome_str4;
waitUntil {sleep 0.223;time >= _end_welcome || {vehicle player == player} || {player != driver _vec} || {!alive player} || {__pGetVar(xr_pluncon)}};
67322 cutRsc ["XDEmpty", "PLAIN",1];
GVAR(rsc_end) = true;